Fix documentation of use-package's ':hook' keyword
authorEli Zaretskii <eliz@gnu.org>
Sat, 24 May 2025 09:56:30 +0000 (12:56 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 24 May 2025 09:56:30 +0000 (12:56 +0300)
* doc/misc/use-package.texi (Hooks): Document how to add several
functions to the same hook (bug#77609).

doc/misc/use-package.texi

index c14e7b77d2344fff58351cb282af41e66cbb9c44..69dd68d7f3aaed92ac3840a87078fadef25a846d 100644 (file)
@@ -1191,8 +1191,7 @@ keybindings you've set using either the @code{:bind} keyword or the
 @cindex hooks
 @findex :hook
 The @code{:hook} keyword allows adding functions to hooks.  It takes
-@c FIXME: The actual forms accepted by :hook are different, see below!
-one argument of the form @var{hooks}, specifying one or more functions
+one argument of the form @var{hooks}, specifying  or more functions
 to add to one or more hooks.  For the purposes of @code{:hook}, the
 name of hook variables should always exclude the @samp{-hook} suffix.
 It is appended automatically for you, to save some typing.
@@ -1265,6 +1264,17 @@ applied, the following examples are all equivalent:
 @end group
 @end lisp
 
+To add more than one function to the same hook, add them separately,
+like this:
+
+@lisp
+@group
+(use-package company
+  :hook ((prog-mode . company-mode)
+         (prog-mode . some-other-function)))
+@end group
+@end lisp
+
 One common mistake when using @code{:hook} is to forget to omit the
 @samp{-hook} suffix, which, as already explained, is appended
 automatically.  Therefore, the following will not work, as it attempts